package com.qfedu.zy.controllers;

import com.qfedu.zy.pojos.User;
import com.qfedu.zy.services.impl.IUserServiceImpl;
import org.apache.shiro.authc.UnknownAccountException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserServiceImpl userService;

    @RequestMapping("/login.do")
    public String doLogin(Model model, String userName, String userPwd){

        try {
            userService.queryUser(userName,userPwd);
        } catch (Exception e) {
            model.addAttribute("tips","账号或密码错误");
            return "/login.jsp";
        }
        return "/index.jsp";


    }

    @RequestMapping("/regist.do")
    public String doRegist(){

        return "";
    }

}
